<?php
$l = OC_L10N::get('company');
$user = PFactory::getUser();

if(isset($user->cb_usertype) && $user->cb_usertype == 'jobseeker'){
   return;
}

OCP\App::addNavigationEntry( array( "id" => "company_index",
                           "order" => 0,
                           "href" => OCP\Util::linkToRoute("company_home"),
                           "class" => "hr_i_companycenter",
                           "name" => "企业中心" ));

/* link to joomla framework */

require_once(OC::$SERVERROOT.'/apps/joomla/application.php');
// require_once(OC::$SERVERROOT.'/apps/company/lib/group.php');

JLoader::import('joomla.application.component.model', JPATH_LIBRARIES);
JLoader::register("Securimage", JPATH_SITE.'/components/com_captcha/securimage/securimage.php');
JLoader::register("CensorHelper", JPATH_SITE.'/components/com_censor/helper.php');
JLoader::register("CompanyHelper", JPATH_SITE.'/components/com_company/helper.php');
// init pipapai application 
PFactory::init(); 

// register a customized group 
// OC_Group::useBackend(new OC_Group_Custom());

if(PFactory::isMasterUser()) {
   OCP\App::addNavigationEntry( array( "id" => "company_settings",
                              "order" => 10,
                              "href" => OCP\Util::linkToRoute("company_settings"),
                              "class" => "hr_i_setting",
                              "name" => "账户设置" ));
} else {
   OCP\App::addNavigationEntry( array( "id" => "company_settings",
                              "order" => 10,
                              "href" => OCP\Util::linkToRoute("company_changepassword"),
                              "class" => "hr_i_setting",
                              "name" => "账户设置" ));
}
